package com.APISecond.NewDate;

import java.time.Clock;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class ZoneId_ {
    public static void main(String[] args) {
        //1.常见方法  获取系统默认时区的ID
        ZoneId zoneId=ZoneId.systemDefault();
        System.out.println(zoneId);
        System.out.println(zoneId.getId());
        //2.获取Java支持的全部时区ID
        System.out.println(ZoneId.getAvailableZoneIds());
        //3.把某个ID封装成时区对象
        ZoneId zoneId1=ZoneId.of("America/New_York");
        ZonedDateTime now=ZonedDateTime.now(zoneId1);
        System.out.println(now);

        ZonedDateTime now1=ZonedDateTime.now(Clock.systemUTC());
        System.out.println(now1);//世界标准时间

        ZonedDateTime now2=ZonedDateTime.now();
        System.out.println(now2);

    }
}
